<!DOCTYPE HTML>
<html lang="zh-CN" style="background: #efeff4;"><head>
<title>{$name}</title>
<meta charset="UTF-8">
<meta name="viewport" content=" initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
	<link href="{$Think.config.RESOURCEURL}wx_assets/bootstrap/bootstrap.min.css" rel="stylesheet">
	
	<link href="{$Think.config.RESOURCEURL}wx_assets/css/common.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
	<link href="{$Think.config.RESOURCEURL}wx_assets/micontent/materiaDetail.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
<!--<link href="{$Think.config.RESOURCEURL}wx_assets/iconfont/duobao/iconfont.css" rel="stylesheet">
-->	<link href="{$Think.config.RESOURCEURL}wx_assets/css/swiper.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
	
	<link href="{$Think.config.RESOURCEURL}wx_assets/indiana/style.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
	<!-- <script src="http://sdk.talkingdata.com/app/h5/v1?appid=DE13C350F41F5DE78FEC51DB5DE730D1&vn=v2&vc=v2"></script> -->
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/jquery-2.0.3.min.js{$Think.config.RESOURCE_VER}"></script>
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/bootstrap/bootstrap.min.js{$Think.config.RESOURCE_VER}"></script>
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/swiper.jquery.min.js{$Think.config.RESOURCE_VER}"></script>	
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/wx_share_byhyj.js{$Think.config.RESOURCE_VER}"></script>
	<script src="{$Think.config.RESOURCEURL}wx_assets/js/util.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
	<!--<script src="{$Think.config.RESOURCEURL}wx_assets/js/product/timer.js" type="text/javascript"></script>	-->
	<script src="{$Think.config.RESOURCEURL}wx_assets/js/product/indiana.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>		
	<script src="{$Think.config.RESOURCEURL}wx_assets/js/layer.m.js" type="text/javascript"></script>
</head>
<script>
	var isrec=true;
</script>

<body class="hasBottom">
	<!--关注浮层 begin-->
	<!--0表示未关注，1表示已关注-->
	<if condition="$subscribe eq '0'">
	<style>
		.careview
		{
			position: fixed;
			top: 0px;
			left: 0px;
			right: 0px;
			padding: 8px 110px 8px 65px;
			background: rgba(0,0,0,0.5);
			z-index: 999;
			color: white;
			height: 61px;
			box-sizing: border-box;
		}
		.careview > span
		{
			content: '';
			display: block;
			position: absolute;
			top: 50%;
			right: 5px;
			background: url({$Think.config.RESOURCEURL}wx_assets/images/careclose.png) no-repeat;
			width:18px;
			height: 18px;
			margin-top: -9px;
			background-size: contain;
			opacity: 0.8;
		}
		.careview > img
		{
			display: block;
			
			width: 45px;
			height: 45px;
			border-radius: 4px;
			position: absolute;
			top: 50%;
			left: 10px;
			margin-top: -22px;
		}
		.careview > a
		{
			background: #1c93ce;
			display: block;
			color: white;
			text-align: center;
			border-radius: 4px;
			width: 75px;
			height: 35px;
			line-height: 35px;
			font-size: 14px;
			top: 50%;
			margin-top: -17px;
			right:35px;
			position: absolute;
			
		}
		.careview > p
		{
			display: inline-block;
			vertical-align: middle;
			font-size: 14px;
			padding: 3px 0px;
			max-height: 38px;
			overflow: hidden;
			height: 100%;
			line-height: 38px;
		}
	</style>
	<div class="careview">
		<img src="{$mall.logo}" alt="" />
		<a href='{$mall.wechaturl}'>立即关注</a>
		<empty name="mall.recommend">
			<p>{$mall.wechatname}</p>
			<else />
			<p>{$mall.recommend}</p>
		</empty>
		
		<span></span>
	</div>
	<script>
		$('.careview > span').on('click',function(){
			$('.careview').hide();
		});
	</script>
	</if>
	<!--关注浮层 end-->
	<input type="hidden" value="{$millData.newperiod.id}" id="perid"/>
	<input type="hidden" value="{$millData.newperiod.fromOpenId}" id="fromOpenId"/>
	<input type="hidden" value='{$Think.config.RESOURCEURL}wx_assets/images/defaultHeadImg.png{$Think.config.RESOURCE_VER}' id="defaultImg"/>
	<header class="main" >
			<div class="ui-top child">
				<a onclick="history.go(-1);" class="ui-tBtn"><i class="iconfont">&#xe600;</i></a>
				<div class="middle">
					商品详情
				</div>
			</div>
	</header>
	<div id="mySwipe" class="swiper-container" style="margin-top: 0px;background: white;">
		<div class="swiper-wrapper">
			<volist name="picUrl1" id="pi" offset="1">
				<div class="swiper-slide">
					<a href=""><img src="{$pi:picUrl}"></a>
				</div>
			</volist>
		</div>
		<div class="swiper-pagination"></div>
	</div>
	<script>
		 // 图片轮播
    function picSwipe(){
      var len=0;
      var mySwiper = new Swiper('.swiper-container',{
			pagination : '.swiper-pagination',
			loop:true,
			onInit: function(swiper){
		      //Swiper初始化了
		      len=swiper.slides.length-2;
		      $('.swiper-detail-num').html('1/'+len);
		      //swiper自带图片延迟加载 监听滑动底部加载列表
		      
    		},
    		onSlideChangeStart:function(swiper){
    			 console.log(swiper.activeIndex);
			      var activeindex=swiper.activeIndex;
			      if(activeindex>len)
			      {
			      	
			      	activeindex=swiper.activeIndex-len;
			      }
			      else if(activeindex < 1)
			      {
			      	activeindex=len;
			      }
			      $('.swiper-detail-num').html(activeindex+'/'+len);
    		}
   		})
    }
    picSwipe();
	</script>
	<div class="ui-prodetail">
		<div class="ui-detop row">
			<div class="col-xs-12 ui-detitle">
				
			<if condition="$millData['newperiod']['periodState'] eq '1'">
				<i class="ui-status yellow bk">进行中</i>	
			</if>
			<if condition="$millData['newperiod']['periodState'] eq '2'">
				<i class="ui-status yellow bk">揭晓中</i>
			</if>
			<if condition="$millData['newperiod']['periodState'] eq '3'">
				<i class="ui-status yellow bk">已揭晓</i>
			</if>
			<if condition="$millData['newperiod']['periodState'] eq '4'">
				<i class="ui-status disabled bk">已取消</i>
			</if>
			<if condition="$millData['newperiod']['periodState'] eq '5'">
				<i class="ui-status disabled bk">取消中</i>
			</if>
			(第{$millData.newperiod.perNumber}期){$name}
			</div>
		</div>
		<if condition="$millData['newperiod']['periodState'] eq '1'">
			<div class="prograss" data-pec="{$millData['newperiod']['beenSold']/$totalCopies*100}">
				<span></span>
			</div>
			<div class="ui-s-msg">
				<p>总需<i>{$totalCopies}</i>人次</p>
				<p>剩余<i>{$millData['newperiod']['surplus']}</i></p>
			</div>
			
		</if>
		<if condition="$millData['newperiod']['periodState'] eq '2'">
			<div class="timer">
				<!--揭晓倒计时   <p style="display:inline;" class="lxftime" nowtime="3/9/2014 23:56:47" endtime="4/9/2014 00:00:00" col="0" lxfday="no">111</p>-->
				正在揭晓中，请耐心等待...
				<a href="call.html?userName=&customerId={$customerId}&module=allChips&method=calculation&params=%7B%22perId%22:{$millData.newperiod.id}%7D">计算详情</a>
			</div>
		</if>
		<if condition="$millData['newperiod']['periodState'] eq '3'">
			<volist name="millData.winning.list" id="mw">
				<div class="ui-hj media">
					<div class="ui-hjinner" <if condition="$mw.parState eq '3'">style="padding-bottom:10px;"</if>>
							  <div class="media-left" style="vertical-align: middle;">
							  	  <empty name="mw.headimgurl">
							  	  	 <img class="media-object" src="{$Think.config.RESOURCEURL}wx_assets/images/defaultHeadImg.png{$Think.config.RESOURCE_VER}" alt="...">
									<else />
									 <img class="media-object" src="{$mw.headimgurl}" alt="...">
								  </empty>
							     
							  </div>
							  <div class="media-body" style="vertical-align: middle;">
							 	    <p>获奖者：<i class="ui-his-uname">{$mw.nickname}</i>({$mw.city})</p>
							 	     <if condition="$mw.parState eq '2'">
							 	     	<p>本期参与：{$millData.winning.count}人次</p>
							 	     </if>
									<p>揭晓时间：{$millData.newperiod.updataTime}</p>
							  </div>
							  <if condition="$mw.parState eq '2'">
								  <div class="hjcode">
								  	 <div class="timer">
								  	 	幸运号码：{$millData.newperiod.wNumber}
								  	 	<a href="call.html?userName=&customerId={$customerId}&module=allChips&method=calculation&params=%7B%22perId%22:{$millData.newperiod.id}%7D">计算详情</a>
								  	 </div>
								  </div>
								  
							  </if>
					</div>
					
						<span class="ui-staTag <if condition="$mw.parState eq '3'">oth</if>">
									  	
					    </span>
				   
				    
			    </div>
		    </volist>
		</if>
		<!--<assign name="ucount"></assign>
		<volist name="millData['user_me']['list']" id="vo">
			<p style="display: none;">{$ucount=$ucount+$vo.count}</p>
		</volist>-->
		<div class="ui-s-msg warm nojoin">
			<if condition="($millData['user_me']['count'] eq '0') OR ($millData['user_me']['count'] eq null)">
				您没有参与本期夺宝哦！
				<else />
				
					<if condition="$millData.newperiod.periodState lt 4">
						<p style="margin-bottom: 8px;">你参与了<i style="color: #009ddf;">{$millData.user_me.count}</i>人次</p><br />
						<p>
							夺宝号码：<volist name="millData.user_me.list" id="ul"><span class="nInline">{$ul.number}</span><if condition="$i eq count($millData['user_me']['list'])"><else />&nbsp;&nbsp;&nbsp;</if></volist>
						</p>
					</if>
						
			</if>
			
		</div>
		
	</div>
	<div class="ui-prodetail" style="margin-top: 10px;padding: 0px 10px;">
		<ul class="ui-href-box">
			
			  <li>
			  	<a href="call.html?customerId={$customerId}&module=allChips&method=graphicDetail&params=%7B%22pid%22:{$id}%7D">
			    <i class="iconfont ui-jt">&#xe601;</i>图文详情
			    </a>
			  </li>
			   
			  <li>
			    <a href="call.html?customerId={$customerId}&module=allChips&method=winlist&params=%7B%22pid%22:{$id}%7D">
			    	<i class="iconfont ui-jt">&#xe601;</i>往期揭晓
			  </li>
			  <li>
				<a href="call.html?customerId={$customerId}&module=product&method=getcommentList&params=%7B%22pid%22:{$id}%7D">    
			    	<i class="iconfont ui-jt">&#xe601;</i>晒单分享
			    </a>
			  </li>
		</ul>
	</div>
	<div style="background: white;padding: 10px;margin-top: 10px;">
		<i style="font-size: 15px;">所有参与记录</i>
		<span style="float: right;margin-top: 1.5px;">
			(自{$millData.newperiod.createTime}开始)
		</span>
	</div>
	<ul class="ui-history-db">
		<volist name="millData.userPar" id="up">
			<li>
				<empty name="up.headimgurl">
					<img src="{$Think.config.RESOURCEURL}wx_assets/images/defaultHeadImg.png{$Think.config.RESOURCE_VER}"/>
					<else />
					<img src="{$up.headimgurl}"/>
				</empty>
				<p><i class="ui-his-uname">
					<empty name="up.nickname">
						匿名用户
						<else />
						{$up.nickname}
					</empty>	
				</i>({$up.province}IP:{$up.ip})</p>
				<p>参与了{$up.count}人次 {$up.updateTime}</p>
			</li>
		</volist>
		
		
	</ul>
	<div class="gethState">
		没有更多记录
	</div>
			<if condition="$minCopies egt '5'">
		    	<assign name="tmp" value="$minCopies" />
			    <else />
			    <assign name="tmp" value="5" />
		    </if>
		    <if condition="$millData['newperiod']['surplus'] egt $tmp">
		    	<assign name="defaultCopies" value="$tmp" />
		    	<else />
		    	<assign name="defaultCopies" value="$millData.newperiod.surplus" />
		    </if>
		   	<if condition="$minCopies egt $millData['newperiod']['surplus']">
		   		<assign name="dataMin" value="$millData.newperiod.surplus" />
		   		<else />
		   		<assign name="dataMin" value="$minCopies" />
		   	</if>
		   	<empty name="maxCopies">
		   		
		   	<else />
		    <if condition="($maxCopies - $millData['user_me']['count']) egt $millData['newperiod']['surplus']">
		    	<assign name="dataMax" value="$millData.newperiod.surplus" />
		    	<else />
		    	<assign name="dataMax" value="$maxCopies - $millData['user_me']['count']" />
		    </if>
		    <if condition="$dataMax egt $defaultCopies">
		    	<else />
		    	<assign name="defaultCopies" value="$dataMax" />
		    </if>
		    </empty>
	<div class="footer">
		<!--优先判断是否已经结束购买-->
		<if condition="$millData['newperiod']['periodState'] egt '2'">
			<p style="text-indent: 10px;">最新一期正在火热进行中...</p>
			<a onclick="Indiana.goNewPeriod();" class="ui-btn right">
				立即前往
			</a>
			<else />
			<if condition="($millData['user_me']['count'] eq '0') OR ($millData['user_me']['count'] eq null)">
				
				<a onclick="Indiana.PayCtrl(this,true)" class="ui-btn <eq name="inventory" value="1"><eq name="inventoryCount" value="0">disableBtn</eq><else /><elt name="defaultCopies" value="0">disableBtn</elt></eq>" id="pay">
					夺宝
				</a>
				<else />
				
				<a onclick="Indiana.PayCtrl(this,true)" class="ui-btn flex zpl <eq name="inventory" value="1"><eq name="inventoryCount" value="0">disableBtn</eq><else /><elt name="defaultCopies" value="0">disableBtn</elt></eq>" >追加</a>
				<a onclick="Indiana.shareShow();" class="ui-btn flex">去拿推荐奖</a>
				
				<!--推荐奖分享主体-->
				<input type="hidden" value="{$title}" id="recShareTitle"/>
				<input type="hidden" value="{$recommend}" id="recShareDesc"/>
				<input type="hidden" value="{$millData.user_me.headimgurl}" id="recShareHeadimg"/>
				<script>
					var guid="{$guid}";
					isrec=false;
					var title=$('#recShareTitle').val(),
						desc=$('#recShareDesc').val(),
						imgUrl=$('#recShareHeadimg').val();
					var p=$.util.getParamAsObject();
					var _link = '';
					var mallQId = "{$quanInfo.qId}";
					var mallUId = "{$quanInfo.uId}";
					if(p.qId||(mallQId&&mallUId)){
						var params={
							"id":"{$id}",
							"periodId":'{$millData.newperiod.id}',
							"fromOpenId":'{$millData.newperiod.fromOpenId}',
							"qId":p.qId||mallQId,
							"miUId":p.miUId||mallUId
						};
					}else{
						var params={
							"id":"{$id}",
							"periodId":'{$millData.newperiod.id}',
							"fromOpenId":'{$millData.newperiod.fromOpenId}'
						};
					}
					params=encodeURIComponent(JSON.stringify(params));
					_link='{$Think.config.SERVER_HOST}call.html?userName='+'&customerId={$customerId}&module=product&method=getProduct&params='+params;
					console.log(_link);
					wx_share.init({
						"title":title,
				        "desc":desc,
				        "link":_link,
				        "imgUrl":imgUrl,
				        "pkg":{
				            "appId": '{$pkg.appId}',
				            "timestamp": {$pkg.timestamp},
				            "nonceStr": '{$pkg.nonceStr}',
				            "signature": '{$pkg.signature}'
				        },
						success:function(config,shareType){
							var p=$.util.getParamAsObject();
							$.req.get("call.json?customerId={$customerId}&module=quan&method=saveShare",{
								params:{
									"qId":p.qId,
									"sId":"{$sId}",
									"guid":guid,
									"fromGuid":p.fromGuid || "",
									"miUId":p.miUId,
									"shareType":shareType,
									"fromPage":"product_detail"
								}
							},function(data){
								if(data && !data.code){
									guid=data.guid;
								}
							});
						}
					});
				</script>
			</if>
		</if>
		
	</div>
	<div class="mask" id="payCtrl" onclick="Indiana.PayCtrl(this,false,event)" style="display: none;">

		<div class="ui-menu-drsel" data-pm="{$perMoney}">
		<h2>
			人次期数选择
			<a onclick="Indiana.PayCtrl(this,false)" class="close">
				<i class="iconfont">&#xe602;</i>
			</a>
		</h2>
		<form>
		  <div class="form-group">
		    <label for="">参与人次</label>
		    
		    
		  	<div class="ui-plus"  data-total="{$maxCopies}" data-default="{$minCopies}" data-min="{$minCopies}">
							<span class="minus active">
								<i class="iconfont">&#xe603;</i>
							</span>
							<span class="ui-pValue" id="pcount">1</span>
							<span class="plus active">
								<i class="iconfont">&#xe604;</i>
							</span>
			</div>
			
		  </div>
		  <span  class="help-block" style="padding-left: 15px;color: #ff8f12;">加大参与人次，中奖几率更高！</span>
		  <div class="form-group">
		    <label for="">参与期数</label>
		    <div class="ui-plus" data-min="1" <if condition="$inventory eq '1'">data-total="{$inventoryCount}"</if> >
							<span class="minus active">
								<i class="iconfont">&#xe603;</i>
							</span>
							<span class="ui-pValue" id="periodCount">1</span>
							<span class="plus active">
								<i class="iconfont">&#xe604;</i>
							</span>
			</div>
			
			
			 
		  </div>
		  <div class="form-group">
			<p>共<i id="totalPer">1</i>人次，总计：<i id="totalPay" style="color: #ff8f12;">1夺宝币</i></p>
		  </div>
		  <div class="form-group ui-pay">
		  	 <a id="indBuySubmit" <if condition="$defaultCopies eq '0'">class="disable"</if>>
			  立即支付
		 	 </a>
		  </div>
		  
		</form>
	</div>
			
	</div>
	<div class="mask shareMask" style="display: none;" onclick="$(this).hide();">
		<img src="{$Think.config.RESOURCEURL}wx_assets/indiana/images/share.png" />
	</div>
</body>
<script>
	var p=$.util.getParamAsObject();
	var buyParams={
		"qId":p.qId||"{$quanInfo.qId}",
		"miUId":p.miUId||"{$quanInfo.uId}",
		"vId":"{$vId}",
		"shareId":"{$sId}",
		"shareFromGuid":p.fromGuid,
		"userName":'{$userName}',
		"visitId":"{$visitId}",
		"distributionId":"{$distributionId}",
		"proSource":'{$proSource}'
	};
	var pagefrom=$.util.getParam('pagefrom');
	//来自支付成功
	if(pagefrom=='indianaSuccess')
	{
		Indiana.shareShow();
	}

	//写cookies 
	function setCookie(name,value) 
	{ 
	    var Days = 30; 
	    var exp = new Date(); 
	    exp.setTime(exp.getTime() + Days*24*60*60*1000); 
	    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString(); 
	} 
	
	//读取cookies 
	function getCookie(name) 
	{ 
	    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
	 
	    if(arr=document.cookie.match(reg))
	 
	        return unescape(arr[2]); 
	    else 
	        return null; 
	} 
	
	//删除cookies 
	function delCookie(name) 
	{ 
	    var exp = new Date(); 
	    exp.setTime(exp.getTime() - 1); 
	    var cval=getCookie(name); 
	    if(cval!=null) 
	        document.cookie= name + "="+cval+";expires="+exp.toGMTString(); 
	} 
	
//	var isFirst=getCookie('isFirst');
//	console.log(isFirst);
	//第一次来,弹出提示
//	if(isFirst==null)
//	{
//
//		layer.open({
//			 content: '<h2 class="cmTitle" style="border-color:#ff8f12;">玩法说明：</h2>'
//			 +'<div class="cmBox">'
//			 +'<p>1、支付1元购买，可以获得其中1个号码（系统随机分配），购买多次中奖几率更大；</p>'
//			 +'<p>2、当所有号码都被分配完毕后，系统经过绝对公平公正的计算出1个幸运号码，持有该号码的用户，直接获得该商品；</p>'
//			 +'<p>3、购买完成后分享给好友，好友中奖你可以获得推荐奖；</p>'
//			 +'<p>4、规定时间无法凑齐商品所需的份数，系统自动退款。</p>'
//			 +'</div>',
//   			 btn: ['我会玩啦']
//		});
//		setCookie('isFirst',1);
//	}
</script>
<script>
	if(isrec)
	{
		wx_share.init({
						"title":'{$title}',
				        "desc":'{$recommend}',
				        "link":'',
				        "imgUrl":'{$millData.user_me.headimgurl}',
				        "pkg":{
				            "appId": '{$pkg.appId}',
				            "timestamp": {$pkg.timestamp},
				            "nonceStr": '{$pkg.nonceStr}',
				            "signature": '{$pkg.signature}'
				        }
		});
	}
	$(function() {
	
	
    
    
    //进度条
    var proGrassControl=function(obj){
    	var pr=obj.attr('data-pec');
    	obj.find('span').css({
    		"width":pr+'%'
    	});
    }($('.prograss'))
    
    
	
	//倒计时
//	lxfEndtime();
	
	
	Indiana.uictrl();
	Indiana.getOrderDetail();
	
	
	//第一次加载记录
	var firstLoadhis=function(){
		var customerId=$.util.getParam('customerId'),
//			periodId=$.util.getParamAsObject().periodId,	
			periodId=$('#perid').val(),
			limit=20,
			start=0,
			params={
				"periodId":periodId,
				"start":start,
				"limit":limit
			};
			_url=Indiana.getUrl("json","allChips","getHistoryList",params);
			console.log(_url);
			
			
			$.ajax({
				url:_url,
				type:"GET",
				dataType:"JSON",
				beforeSend:function(){
					 
				},
				success:function(data){
					 
					console.log(data);
					if(data==null)
					{
//						alert('没有更多数据了')
						$('.gethState').show();
						Indiana.option.isAll=true;
					}
					else
					{
						//填充数据ui-history-db
						for(var i=0;i<data.length;i++)
						{
							
							var imgurl=data[i].headimgurl!=''&&data[i].headimgurl!=null?data[i].headimgurl:$('#defaultImg').val(),
								nickname=data[i].nickname!=''&&data[i].nickname!=null?data[i].nickname:'匿名用户';
							var li='<li>'
								+'<img src="'+imgurl+'"/>'
								+'<p><i class="ui-his-uname">'+nickname+'</i><br /><i class="c8">('+data[i].city+'IP:'+data[i].ip+')</i></p>'
								+'<p>参与了<i style="color:#ff8f12">'+data[i].count+'</i>人次<i class="c8"> '+data[i].updateTime+'</i></p>'
								'</li>';
							$('.ui-history-db').append(li);
						}
						Indiana.option.count++;
						if(data.length<limit)
						{
							$('.gethState').show();
							Indiana.option.isAll=true;
						}
					}
					if($('.ui-history-db > li').length==1)
					{
						$('.ui-history-db > li').css({
							"border":'0px'
						})
					}
					Indiana.checkBottom();
				}
			})
		
	}()
	
		
});

</script>
</html>
